<extend name="Base:common" />
<block name="static">
<link rel="stylesheet" href="__CSS__/goodsdetails.css" />
<link rel="stylesheet" href="__CSS__/pslocation.css" />
<link rel="stylesheet" href="__CSS__/magnifier.css" />
<script src="__PUBLIC__/js/jquery.min.js"></script>
<script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
    <script>
    	//倒计时
		function GetRTime(){
			var EndTime= new Date("{$goodsDetails['seckillTime']}");
			var NowTime = new Date();
			if((EndTime.getTime() - NowTime.getTime())>0){
				var t =EndTime.getTime() - NowTime.getTime();
			}else{
				var t =NowTime.getTime() - EndTime.getTime();
			}

			var d=0;
			var h=0;
			var m=0;
			var s=0;
			if(t>=0){
				d=Math.floor(t/1000/60/60/24);
				h=Math.floor(t/1000/60/60%24);
				m=Math.floor(t/1000/60%60);
				s=Math.floor(t/1000%60);
			}
			document.getElementById("t_d").innerHTML = d;
			document.getElementById("t_h").innerHTML = h;
			document.getElementById("t_m").innerHTML = m;
			document.getElementById("t_s").innerHTML = s;
			}

        //解决限购数量和对于库存直接的关系
        function checkAttrStockAndLimit(){
            var AttrKuCun= parseInt($('#goodsAttrStock').text());
            var limitNum=parseInt($('#goodsStock').text());
            var seckillMaxCount=$('#seckillMaxCount').val();
            if(limitNum >= AttrKuCun){
                $('#goodsStock').text(AttrKuCun);
                $('#buy-num').attr('maxVal',AttrKuCun);
                if($('#buy-num').val()>AttrKuCun)$('#buy-num').val('1');
            }else{
                $('#goodsStock').text(seckillMaxCount);
                $('#buy-num').attr('maxVal',seckillMaxCount);
            }
        }
        setInterval(checkAttrStockAndLimit,0);
        setInterval(GetRTime,0);
		</script> 
</block>
<block name="body">
		<input id="shopId" type="hidden" value="{$goodsDetails['shopId']}"/>
		<input id="goodsId" type="hidden" value="{$goodsDetails['goodsId']}"/>
		<input id="isSeckill" type="hidden" value="{$goodsDetails['isSeckill']}"/>
        <input id="seckillMaxCount" type="hidden" value="{$goodsDetails['seckillMaxCount']}"/>
		<!--加载商品楼层start-->
		<div class="wst-container">
			<div class="wst-nvg-title" style="overflow: hidden; /*自动隐藏文字*/
    text-overflow: ellipsis;/*文字隐藏后添加省略号*/
    white-space: nowrap;/*强制不换行*/
    width: 30em;/*不允许出现半汉字截断*/">
				<a href="{:U('Home/index/index/')}">首页</a>&nbsp;>&nbsp;
				<a href="{:U('Home/Seckill/index/')}">秒杀商品</a>&nbsp;>&nbsp;
				{$goodsDetails["goodsName"]}
			</div>
			<div class="wst-goods-details">
				<div class="details-left">
					<div class="goods-img-box">
						 <!--产品参数开始-->
						  <div>
						    <div id="preview" class="spec-preview"> 
							    <span class="jqzoom">
							    	<img jqimg="__ROOT__/{$goodsDetails['goodsImg']}" src="__ROOT__/{$goodsDetails['goodsImg']}" height="350" width="350"/>
							    </span> 
						    </div>
						    <!--缩图开始-->
						    <div class="spec-scroll"> <a class="prev">&lt;</a> <a class="next">&gt;</a>
						      <div class="items">
						        <ul>
						        	<li><img alt="" bimg="__ROOT__/{$goodsDetails['goodsImg']}" src="__ROOT__/{$goodsDetails['goodsImg']}" onmousemove="preview(this);"></li>
						        	<volist name="goodsImgs" key="k" id="vo">
						          		<li><img alt="" bimg="__ROOT__/{$vo['goodsImg']}" src="__ROOT__/{$vo['goodsImg']}" onmousemove="preview(this);"></li>
						          	</volist>
						        </ul>
						      </div>
						    </div>
						    <!--缩图结束-->
						  </div>
						  <!--产品参数结束-->
						  <div class='wst-short-tool'>
						       <div style='float:left;'>商品编号：{$goodsDetails["goodsSn"]}</div>
						       <div style='float:right;'>
						         <a href='javascript:favoriteGoods({$goodsDetails['goodsId']})'>
						         <b></b>
						         <span id='f0_txt' f='{$favoriteGoodsId}'>
						         <if condition="$favoriteGoodsId gt 0">已关注<else/>关注商品</if>
						         </span>
						         </a>
						       </div>
						  </div>
					</div>
					<div class="goods-des-box">
						<table class="goods-des-tab">
							<tbody>
								<tr>
									<td colspan="2">
										<div class="des-title" style="word-break:break-all;">
											{$goodsDetails["goodsName"]}
										</div>
										<div class='wst-goods-spec'>{$goodsDetails["goodsSpec"]|htmlspecialchars_decode}</div>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<div>
											店铺价：<span style="text-decoration:line-through;margin:0 20px 0 0;">￥{$goodsDetails["shopPrice"]}</span>
											折扣：<font color="red" style="margin:0 20px 0 0;">{$goodsDetails["discount"]}折</font>
											为您节省：<font color="red">￥{$goodsDetails["disparity"]}</font>
										</div>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<div>
											秒杀价：<span id='shopGoodsPrice_{$goodsDetails["goodsId"]}' dataId='{$goodsDetails["goodsAttrId"]}' style="color:red;font-size:25px;">￥{$goodsDetails["seckillPrice"]}</span>
										</div>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<span style="margin:0 20px 0 0;font-size:16px;">
											<img src="__IMG__/count_down.jpg" width="20" height="20" style="margin-top:-2px;">距离秒杀{$goodsDetails["state"]}还有：<span id="t_d" style="font-size:24px;color: red">00</span>天<span id="t_h" style="font-size:24px;color: red">00</span>时<span id="t_m" style="font-size:24px;color: red">00</span>分<span id="t_s" style="font-size:24px;color: red">00</span>秒
										</span>

									</td>
								</tr>
								<tr>
									<td width="70"><span class="des-title-span">配送至：</span></td>
									<td>
										<li id="summary-stock">
											<div class="dd">
												<div id="store-selector">
													<div class="text">
														<div></div>
														<b></b>
													</div>
												</div><!--store-selector end-->
												<div id="store-prompt">
													<strong></strong>
												</div>
											</div>
										</li>
										<div class="wst-clear"></div>
									</td>
								</tr>
								<tr>
									<td width="70"><span class="des-title-span">运费：</span></td>
									<td>{$goodsDetails["deliveryStartMoney"]}元起，配送费{$goodsDetails["deliveryMoney"]}元，{$goodsDetails["deliveryFreeMoney"]}元起免配送费</td>
								</tr>
								<tr>
									<td width="70"><span class="des-title-span">服务：</span></td>
									<td>由
									<if condition="$goodsDetails['deliveryType'] eq 1">
										{$CONF['mallName']}
									<else/>
										<a href="{:U('Home/Shops/toShopHome/',array('shopId'=>$goodsDetails['shopId']))}">{$goodsDetails['shopName']}</a>
									</if>
									配送，并提供售后服务</td>
								</tr>
								<if condition=" count($goodsAttrs['priceAttrs']) gt 0">
								<tr style='height:15px;border-top:1px dashed #ddd;'>
								   <td colspan='2'></td>
								</tr>
									<volist name="goodsAttrs['priceAttrs']" id="vo">
									<tr>
										<td width="70"><span class="des-title-span">{$vo["name"]}：</span></td>
										<td>
										 <volist name="vo" id="avo" key="key">
										 	<if condition="is_array($avo) eq true">
											 <span class='wst-goods-attrs <if condition=" $avo['isRecomm'] eq 1">wst-goods-attrs-on</if>'  dataId='{$avo["id"]}' onclick='javascript:checkStock(this);'>{$avo['attrVal']}</span>
											 </if>
											 </volist>
										</td>
									</tr>
									</volist>
								</if>
								<if condition="$goodsDetails['shopServiceStatus'] eq 1">
								<tr>
									<td ><span style="">购买数量：</span></td>
									<td>
										<div id="haveGoodsToBuy" <if condition="$goodsDetails['goodsStock'] elt 0">style="display:none;"</if>>
											<div class="goods-buy-cnt">
												<div class="buy-cnt-plus" onclick="changebuynum(1)"></div>
												<input id="buy-num" type="text" class="buy-cnt-txt" value="1" maxVal="{$goodsDetails['seckillMaxCount']}" maxlength="3" onkeypress="return WST.isNumberKey(event);" onkeyup="changebuynum(0);" autocomplete="off"/>
												<div class="buy-cnt-add" onclick="changebuynum(2)"></div>
											</div>
											<div class='wst-goods-stock'>限购：<span id='goodsStock'>{$goodsDetails['seckillMaxCount']}</span>{$goodsDetails['goodsUnit']} 库存：<span id="goodsAttrStock">{$goodsDetails['goodsStock']}</span>{$goodsDetails['goodsUnit']}</div>
										</div>
										<div id="noGoodsToBuy" <if condition="$goodsDetails['goodsStock'] gt 0">style="display:none;"</if>>
											<div style="font-weight: bold;">所选地区该商品暂时无货，非常抱歉！</div>
											<div style="clear: both;"></div>
											<br />
											<div>
												<a id="InitCartUrl" class="btn-append " href="javascript:void(0);" title="">
													<span>
														<img src="__IMG__/hcat.jpg" />
													</span>
												</a>
											</div>
										</div>
									</td>
								</tr>
								<else/>
								<tr>
									<td colspan="2">
										<div class="wst-gdetail-wait">休息中,暂停营业</div>
									</td>
								</tr>
								</if>
								<tr>
									<td style="position: relative;">
									<div id='qrBox' style='position:absolute ;top:-50px;left:450px;padding:2px;'>
										<div id='qrcode' style='width:132px;height:132px;border:1px solid #ddd;margin-bottom:2px;'></div>
										<div>下载移动客户端扫一扫</div>
									</div>
									</td>
									<td></td>
								</tr>
								<if condition="$goodsDetails['goodsStock'] gt 0">
								<tr>
									<td width="70"></td>
									<td>
										<if condition="$comefrom eq 1">
											<img src="__IMG__/hcat.jpg" />
										<else/>
											<php>if($goodsDetails['shopServiceStatus'] ==1 && $goodsDetails['state']=="结束" && $goodsDetails['seckillMaxCount']!=0){</php>
												<a href="javascript:addCart({$goodsDetails['goodsId']},0,'{$goodsDetails['goodsThums']}')" class="btnCart"><img src="__IMG__/btn_buy_01_hover.png" width="112" height="38"/></a>
												&nbsp;&nbsp;
												<a href="javascript:addCart({$goodsDetails['goodsId']},1)" class="btn2Cart">
													<img src="__IMG__/btn_buy_02.png" width="112" height="38"/>
												</a>
											<php>}else if($goodsDetails['shopServiceStatus'] ==0 || $goodsDetails['state']=="开始" || $goodsDetails['seckillMaxCount']==0){</php>
											
												<img src="__IMG__/hcat.jpg" />
											<php>}</php>
										</if>
									</td>
								</tr>
								</if>
							</tbody>
						</table>
						
					</div>
				</div>
				<div class="details-right">
					<table class="details-tab">
						<tbody>
							<tr>
								<td class="title">店铺名称：</td>
								<td>{$goodsDetails["shopName"]}</td>
							</tr>
							<tr>
								<td class="title">营业时间：</td>
								<td>{$goodsDetails['serviceStartTime']}-{$goodsDetails['serviceEndTime']}</td>
							</tr>
							<tr>
								<td class="title">配送说明：</td>
								<td>{$goodsDetails["deliveryStartMoney"]}元起，配送费{$goodsDetails["deliveryMoney"]}元<br/>{$goodsDetails["deliveryFreeMoney"]}元起免配送费<br/><br/></td>
							</tr>
							<tr>
								<td class="title">店铺地址：</td>
								<td>{$goodsDetails['shopAddress']}</td>
							</tr>
							<tr>
								<td class="title">店铺电话：</td>
								<td>{$goodsDetails['shopTel']}</td>
							</tr>
							<if condition="$goodsDetails['qqNo'] neq ''">
							<tr>
								<td class="title">&nbsp;QQ咨询：</td>
								<td>
									<a href="tencent://message/?uin={$goodsDetails['qqNo']}&Site=QQ交谈&Menu=yes">
									<img border="0" src="http://wpa.qq.com/pa?p=1:{$goodsDetails['qqNo']}:7" alt="QQ交谈" width="71" height="24" />
									</a><br/>
								</td>
							</tr>
							</if>
							<tr>
								<td ></td>
								<td></td>
							</tr>
							<tr>
								<td colspan="2" class="wst-shop-eval">
									<div class="shop-eval-box" style="width:220px;margin:0 auto;">
										    <li>商品<br/>{$shopScores["goodsScore"]}</li>
											<li class="li-center">时效<br/>{$shopScores["timeScore"]}</li>
											<li>服务<br/>{$shopScores["serviceScore"]}</li>
										<div class="wst-clear"></div>
									</div>
								</td>
							</tr>
							<tr>
								<td ></td>
								<td></td>
							</tr>
							<tr>
								<td colspan="2" class="wst-shop-eval">
									<div class="shop-eval-box" style="width:214px;margin:0 auto;">
										<a class='wst-shop-btn' href="{:U('Home/Shops/toShopHome/',array('shopId'=>$goodsDetails['shopId']))}">
										进入店铺
										</a>
										<a class='wst-shop-btn' href="javascript:favoriteShops({$goodsDetails['shopId']})">
										<span id='f1_txt' f='{$favoriteShopId}'><if condition="$favoriteShopId gt 0">已关注<else/>关注店铺</if></span>
										</a>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="wst-clear"></div>
			</div>
			
			<div class="wst-goods-pdetails">
				<div class="wst-goods-pdetails-left">
					{:W('Goods/getHotGoods',array('shopId'=>$goodsDetails['shopId']))}
					{:W('Goods/getViewGoods')}
				</div>
				<div id="wst-goods-pdetails-right" class="wst-goods-pdetails-right">
					<div class="goods-nvg">
						<ul class="tab">
							<li onclick="tabs('#wst-goods-pdetails-right',0)" class="curr">商品介绍</li>
							<if condition=" count($goodsAttrs['attrs']) gt 0">
							<li onclick="tabs('#wst-goods-pdetails-right',1)">商品属性</li>
							<li onclick="tabs('#wst-goods-pdetails-right',2)">商品评价</li>
							<else/>
							<li onclick="tabs('#wst-goods-pdetails-right',1)">商品评价</li>
							</if>
						</ul>
						<div class="wst-clear"></div>
					</div>
					<div class="tabcon">
						<div id="wst_goods_desc" style="font-weight:bolder;height:auto;line-height:30px;padding-left:8px;">
						{$goodsDetails["goodsDesc"]}
						</div>
					</div>
					<if condition=" count($goodsAttrs['attrs']) gt 0">
					<div class="tabcon" style="display:none;">
						<table class='wst-attrs-list'>
						  <volist name="goodsAttrs['attrs']" id="vo">
						  <if condition="$vo['attrContent'] !='' ">
						  <tr>
						    <th nowrap>{$vo['attrName']}：</th>
						    <td>{$vo['attrContent']}</td>
						  </tr>
						  </if>
						  </volist>
						</table>
					</div>
					</if>
					<div class="tabcon"  style="display:none;">						
						<table id="appraiseTab" width="100%">
							<tr>
								<td>
		                      	 	<div style="margin-top: 10px;" id="allgoodsppraises">
		                           		 请稍等...
		                        	</div>
		                        </td>
		                	</tr>
	                   	</table>  
	                   	<div id="wst-page-items" style="text-align:center;margin-top:5px;"></div>                  
					</div>
					<div class="wst-clear"></div>
				</div>
				<div class="wst-clear"></div>
			</div>
			<div class="wst-clear"></div>
		</div>
</block>
<block name="footer_static">
<script src="__JS__/goods.js"></script>
<script src="__JS__/pslocation.js" type="text/javascript"></script>
<script src="__JS__/jquery.jqzoom.js" type="text/javascript"></script>
<script src="__JS__/magnifier.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/qrcode.js"></script>
<script> 
$("#store-selector").hover(function() {
}, function(){
	$("#store-selector").removeClass("hover");
});


$(function(){
	var qr = qrcode(10, 'M');
	qr.addData("{$qrcode}");
	qr.make();
	$('#qrcode').html(qr.createImgTag());
	getGoodsappraises({$goodsDetails["goodsId"]},0);
	$("#wst_goods_desc img").each(function(){
		if($(this).width()>940){
			$(this).width(940);
		}
	});
});
</script>
</block>


